#include <QStyleOptionGraphicsItem>
#include <QLinearGradient>
#include <QPainter>

#include "DockItem.h"

DockItem::DockItem (QGraphicsItem *parent)
    : UIView(parent)
{
}

DockItem::~DockItem() {
}

void DockItem::drawRect (QPainter *painter, const QRect& rect) {
#if 1
    QPixmap pixmap(":/Resources/Dock.png");

    for (int w = 0; w < rect.width(); w += pixmap.width())
        painter->drawPixmap(rect.x() + w, rect.y(), pixmap);
#else
    painter->save();
    painter->setRenderHint(QPainter::Antialiasing);
    painter->translate(rect.x(), rect.y());
			QLinearGradient gradient(0, 0, 0, rect.height());
			gradient.setColorAt(0.0f, QColor(0x54, 0x54, 0x54));
			gradient.setColorAt(0.1f, QColor(0x3c, 0x3c, 0x3c));
			gradient.setColorAt(0.6f, QColor(0x1c, 0x1c, 0x1c));
			gradient.setColorAt(0.7f, Qt::black);
			gradient.setColorAt(1.0f, Qt::black);

			painter->fillRect(0, 0, rect.width(), rect.height(), gradient);
			painter->setBrush(QColor(0xff, 0xff, 0xff, 42));
			painter->drawRoundedRect(5, 5, rect.height() - 10, rect.height() - 10, 8, 8);
    painter->restore();
#endif
}

